package org.jeecg.modules.simulator.recorder;

import lombok.Getter;
import lombok.Setter;
import org.jeecg.modules.simulator.jsonot.BeforeFiveMinPeople;
import org.jeecg.modules.simulator.vo.TrainPosition;
import org.jetbrains.annotations.NotNull;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: simulator-b20240918
 * @description:
 * @author: renzhg
 * @create: 2024-11-01 15:44
 **/
public class StationInstantInfo implements Comparable<StationInstantInfo>{
    @Getter
    @Setter
    String timePt;
    @Getter
    @Setter
    String stationId;
    @Getter
    @Setter
    String stationName;
    @Getter
    @Setter
    String sceneCode;//





    @Getter
    @Setter
    Integer willInStationInstantNum=0;//将要进站的人的瞬时数字
    @Getter
    Map<String,Integer> willInStationInstantNumMap=new HashMap<>();
    public void insertWillInStationInstantNumMap(String now,Integer num){
        willInStationInstantNumMap.put(now,num);

    }
    @Getter
//    @Setter
    Integer willInStationTotalNum=0;//将要进站的人的合计数字
    @Getter
    Map<String,Integer> willInStationTotalNumMap=new HashMap<>();
    public void insertWillInStationTotalNumMap(String now){
        willInStationTotalNumMap.put(now,this.willInStationTotalNum);
    }



    //站点瞬时出站人数
    @Getter
    @Setter
    Integer stationInstantOutPersonNum=0;
    @Getter
    Map<String,Integer> stationInstantOutPersonNumMap=new HashMap<>();
    public void insertStationInstantOutPersonNumMap(String now,Integer num){
        stationInstantOutPersonNumMap.put(now,num);
    }
    //站点瞬时进站人数---
    @Getter
    @Setter
    Integer stationInstantInputPersonNum=0;
    @Getter
    Map<String,Integer> stationInstantInputPersonNumMap=new HashMap<>();
    public void insertStationInstantInputPersonNumMap(String now,Integer num){
        stationInstantInputPersonNumMap.put(now,num);
    }
    //站点瞬时站内人数
    @Getter
    @Setter
    Integer stationInstantInStationPersonNum=0;

    @Getter
    Map<String,Integer> stationInstantInStationPersonNumMap=new HashMap<>();
    public void insertStationInstantInStationPersonNumMap(String now,Integer num){
        stationInstantInStationPersonNumMap.put(now,num);
        stationInstantInStationPersonNum=num;
    }

    //站点瞬时走行人数
    @Getter
    @Setter
    Integer stationInstantWalkPersonNum=0;
    @Getter
    Map<String,Integer> stationInstantWalkPersonNumMap=new HashMap<>();
    public void insertStationInstantWalkPersonNumMap(String now,Integer num){
        stationInstantWalkPersonNumMap.put(now,num);
    }
    //站点瞬时等车人数
    @Getter
    @Setter
    Integer stationInstantWaitPersonNum=0;
    @Getter
    Map<String,Integer> stationInstantWaitPersonNumMap=new HashMap<>();
public void insertStationInstantWaitPersonNumMap(String now,Integer num){
    stationInstantWaitPersonNumMap.put(now,num);
}


    //站点累计出站人数
    @Getter
    @Setter
    Integer stationTotalOutPersonNum=0;
    @Getter
    Map<String,Integer> stationTotalOutPersonNumMap=new HashMap<>();
    public void insertStationTotalOutPersonNumMap(String now,Integer num){
        stationTotalOutPersonNumMap.put(now,num);
    }
    //站点累计进站人数
    @Getter
    @Setter
    Integer stationTotalInputPersonNum=0;
    @Getter
    Map<String,Integer> stationTotalInputPersonNumMap=new HashMap<>();
    public void insertStationTotalInputPersonNumMap(String now,Integer num){
        stationTotalInputPersonNumMap.put(now,num);
    }
    //站点累计站内人数
    @Getter
    @Setter
    Integer stationTotalInStationPersonNum=0;
    @Getter
    Map<String,Integer> stationTotalInStationPersonNumMap=new HashMap<>();
    public void insertStationTotalInStationPersonNumMap(String now,Integer num){
        stationTotalInStationPersonNumMap.put(now,num);
    }

    //站点累计走行人数
    @Getter
    @Setter
    Integer stationTotalWalkPersonNum=0;
    @Getter
    Map<String,Integer> stationTotalWalkPersonNumMap=new HashMap<>();
    public void insertStationTotalWalkPersonNumMap(String now,Integer num){
        stationTotalWalkPersonNumMap.put(now,num);
    }
    //站点累计等车人数
    @Getter
    @Setter
    Integer stationTotalWaitPersonNum=0;
    @Getter
    Map<String,Integer> stationTotalWaitPersonNumMap=new HashMap<>();
    public void insertStationTotalWaitPersonNumMap(String now,Integer num){
        stationTotalWaitPersonNumMap.put(now,num);
    }




    public void instantReset(){
        this.willInStationInstantNum=0;//将要进站人数
        this.stationInstantOutPersonNum=0;//出站人数
        this.stationInstantInputPersonNum=0;//进站人数
        this.stationInstantInStationPersonNum=0;//站内人数（站内所有的人数=等车人数+走行人数）
        this.stationInstantWalkPersonNum=0;//瞬时走行人数
        this.stationInstantWaitPersonNum=0;//等车人数

    }

    Map<String,Integer> walkInstantMap=new HashMap<>();
    Map<String,Integer> outputInstantMap=new HashMap<>();
    Map<String,Integer> willInputMap=new HashMap<>();







   public void  setStationTotalWillInStationTotalNum(int willInStationInstantNumNum){
       willInStationTotalNum=+willInStationInstantNumNum;
   }
//    //站点累计进站人数
//    public void setStationTotalAndInstantInputPersonNum(int stationTotalInputPersonNum) {
////         this.stationTotalInputPersonNum=this.stationTotalInputPersonNum+stationTotalInputPersonNum;
//         this.stationInstantInputPersonNum=stationTotalInputPersonNum;
//    }
//    //站点累计出站人数
//    public void setStationTotalAndInstantOutPersonNum(int stationTotalOutPersonNum) {
////        this.stationTotalOutPersonNum=this.stationTotalOutPersonNum+stationTotalOutPersonNum;
//        this.stationInstantOutPersonNum=stationTotalOutPersonNum;
//    }
//    //站点累计站内人数
//    public void setStationTotalAndInstantInStationPersonNum(int stationTotalInStationPersonNum) {
////        this.stationTotalInStationPersonNum=this.stationTotalInStationPersonNum+stationTotalInStationPersonNum;
//        this.stationInstantInStationPersonNum=stationTotalInStationPersonNum;
//    }
//    //站点累计走行人数
//    public void setStationTotalAndInstantWalkPersonNum(int stationTotalWalkPersonNum) {
////        this.stationTotalWalkPersonNum=this.stationTotalWalkPersonNum+stationTotalWalkPersonNum;
//        this.stationInstantWalkPersonNum=stationTotalWalkPersonNum;
//    }
//    //站点累计等车人数
//    public void setStationTotalAndInstantWaitPersonNum(int stationTotalWaitPersonNum) {
////        this.stationTotalWaitPersonNum=this.stationTotalWaitPersonNum+stationTotalWaitPersonNum;
//        this.stationInstantWaitPersonNum=stationTotalWaitPersonNum;
//    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("StationInstantInfo{");
        sb.append("timePt=").append(timePt);
        sb.append(", stationId='").append(stationId).append('\'');
        sb.append(", stationName='").append(stationName).append('\'');
        sb.append(", sceneCode='").append(sceneCode).append('\'');
        sb.append(", willInStationInstantNum(将要进站人数)=").append(willInStationInstantNum);
        sb.append(", stationInstantOutPersonNum(出站人数)=").append(stationInstantOutPersonNum);
        sb.append(", stationInstantInputPersonNum(进站人数)=").append(stationInstantInputPersonNum);
        sb.append(", stationInstantInStationPersonNum=").append(stationInstantInStationPersonNum);
        sb.append(", stationInstantWalkPersonNum='").append(stationInstantWalkPersonNum).append('\'');
        sb.append(", stationInstantWaitPersonNum=").append(stationInstantWaitPersonNum);


//        sb.append(", stationTotalOutPersonNum='").append(stationTotalOutPersonNum).append('\'');
//        sb.append(", stationTotalInputPersonNum='").append(stationTotalInputPersonNum).append('\'');
//        sb.append(", stationTotalInStationPersonNum='").append(stationTotalInStationPersonNum).append('\'');
//        sb.append(", stationTotalWalkPersonNum='").append(stationTotalWalkPersonNum).append('\'');
//        sb.append(", stationTotalWaitPersonNum='").append(stationTotalWaitPersonNum).append('\'');
        sb.append('}');
        return sb.toString();
    }

    @Override
    public int compareTo(@NotNull StationInstantInfo o) {
        LocalTime thisTime = LocalTime.parse(this.timePt, DateTimeFormatter.ofPattern("HH:mm:ss"));
        LocalTime otherTime = LocalTime.parse(o.timePt, DateTimeFormatter.ofPattern("HH:mm:ss"));
        return thisTime.compareTo(otherTime);

    }


//    public void printCurrentInfo() {
//        System.out.println("场景名称名称：" + this.sceneCode);
//        System.out.println("站内人数：" + this.allPersonMap.size());
//        System.out.println("下车出站人数：" + this.outStationPersonMap.size());
//        System.out.println("走行人数：" + this.walkingPersonMap.size());
//        System.out.println("等车人数：" + this.waitingPersonMap.size());
//        System.out.println("进站人数：" + this.outsidePersonMap.size());
//        System.out.println("实时站内人数：" + (this.walkingPersonMap.size() + this.waitingPersonMap.size() + this.outsidePersonMap.size()));
//
//    }



}
